# -*- coding:UTF-8 -*-
"""
@Project : pythonProject
@File    : Python-M06.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Address : China - HeiLongjiang - Herbin
@Date    : 2025/7/8 下午9:44
"""
# shoppingCart={'book':20,'apple':19,'cake':6,'banana':12,'shoes':199}
# b.实现一个简易购物车系统：用字典存储商品（键为名称，值为价格）
# i.用户输入购买商品名和数量，实时计算总价
shoppingCart = {
    'book': 20,
    'apple': 19,
    'cake': 6,
    'banana': 12,
    'shoes': 199
}
items = []
price = 0
while 1:
    key = input("Please select the goods you want to purchase(book,apple,cake,banana,shoes): ")
    if key == 'exit':
        print("Successful exit,Looking forward to your next visit!")
        break
    elif key in shoppingCart:
        price += shoppingCart[key]
        items.append(key)
    else:
        print("The product you entered is temporarily not available in our store,Please reselect.!")
print(f"The product you purchased is:{items},The total price of the purchased goods is:{price}")